package is.ejs.bahamut;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class BahamutActivity extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		
		Button diceroll = (Button) findViewById(R.id.mainMenuRollButton);
        diceroll.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                Intent myIntent = new Intent(view.getContext(), DiceRollActivity.class);
                startActivity(myIntent);
            }
        });
	}
	
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.bahamutmenu, menu);
		return true;
	}

	protected Activity act;
	
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
	    case R.id.bahamutabout:
	    	String aboutApp = "Bahamut - advanced dice roller\n" +
					"\n" +
					"Version: 0.1\n" +
					"\n\n" +
					"This software is released under the GNU GPL v3 license.\n" +
					"\n" +
					"Visit http://code.google.com/p/bahamut/\n" +
					"\n\n" +
					"This app is developed by:\n" +
					"\n" +
					"Eiríkur Ernir Þorsteinsson,\n" +
					"Jóhann Björn Björnsson,\n" +
					"Siguróli Ólafsson.";
//			TODO: Skipta þessu Toast út fyrir eitthvað sem
//			hægt er að skilgreina tímann á.
			Toast.makeText(this, aboutApp, Toast.LENGTH_LONG).show();
			return true;
	    case R.id.bahamutsettings:
	    	Intent myIntent = new Intent(act, SettingsActivity.class);
            startActivity(myIntent);
	        return true;
	    default:
	        return super.onOptionsItemSelected(item);
	    }
	}
}